package thread;

public class Demo14 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = Thread.currentThread();
        Thread t2 = new Thread(()->{
            try {
                t.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t2 结束");
        });

        t2.start();

        for (int i = 0; i < 5; i++) {
            Thread.sleep(1000);
        }
        System.out.println("main 结束");
    }
}
